package com.servicesManagement.model;
// Generated Dec 13, 2014 11:53:18 AM by Hibernate Tools 3.2.1.GA

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.Cascade;

/**
 * Attribute generated by hbm2java
 */
@Entity
@Table(name = "ATTRIBUTE", schema = "SANKAR")
public class Attribute implements java.io.Serializable {

    private Long attributeId;
    private BigDecimal changedByUserId;
    private Date changedDate;
    private BigDecimal createdByUserId;
    private Date createdDate;
    private String description;
    
    
    @JsonIgnore
    private Service service = new Service();
   
    private Set<AspectConf> aspectConf= new HashSet<AspectConf>();    

    public Attribute() {
    }

    public Attribute(Long attributeId) {
        this.attributeId = attributeId;
    }

    public Attribute(Long attributeId, BigDecimal changedByUserId, Date changedDate, BigDecimal createdByUserId, Date createdDate, String description, Set attributeGroupConfs, Set serviceParticipationAttributs, Set aspectConfs, Set serviceAttributeConfs, Set attributeGroups, Service services, Set<AspectConf> aspectConf) {
        this.attributeId = attributeId;
        this.changedByUserId = changedByUserId;
        this.changedDate = changedDate;
        this.createdByUserId = createdByUserId;
        this.createdDate = createdDate;
        this.description = description;
        
        this.aspectConf = aspectConf;
       
        this.service= services;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ATTRIBUTE_ID", unique = true, nullable = false, scale = 0)
    public Long getAttributeId() {
        return this.attributeId;
    }

    public void setAttributeId(Long attributeId) {
        this.attributeId = attributeId;
    }

    @Column(name = "CHANGED_BY_USER_ID")
    public BigDecimal getChangedByUserId() {
        return this.changedByUserId;
    }

    public void setChangedByUserId(BigDecimal changedByUserId) {
        this.changedByUserId = changedByUserId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CHANGED_DATE", length = 7)
    public Date getChangedDate() {
        return this.changedDate;
    }

    public void setChangedDate(Date changedDate) {
        this.changedDate = changedDate;
    }

    @Column(name = "CREATED_BY_USER_ID")
    public BigDecimal getCreatedByUserId() {
        return this.createdByUserId;
    }

    public void setCreatedByUserId(BigDecimal createdByUserId) {
        this.createdByUserId = createdByUserId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CREATED_DATE", length = 7)
    public Date getCreatedDate() {
        return this.createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    @Column(name = "DESCRIPTION")
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    

   
    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinTable(name = "SERVICE_ATTRIBUTE_CONF", joinColumns = {
        @JoinColumn(name = "ATTRIBUTE_ID", referencedColumnName = "ATTRIBUTE_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "SERVICE_ID", referencedColumnName = "SERVICE_ID")})
    public Service getService() {
        return service;
    }

    public void setService(Service service) {
        this.service = service;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "attribute", cascade= CascadeType.ALL)
      public Set<AspectConf> getAspectConf() {
        return aspectConf;
    }

    public void setAspectConf(Set<AspectConf> aspectConf) {
        this.aspectConf = aspectConf;
    }

    @Override
    public String toString() {
        return "Attribute{" + "attributeId=" + attributeId + ", changedByUserId=" + changedByUserId + ", changedDate=" + changedDate + ", createdByUserId=" + createdByUserId + ", createdDate=" + createdDate + ", description=" + description + ", aspectConf=" + aspectConf + '}';
    }
    
    

   
    
}
